﻿@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Index.cshtml";
}
<script>
    $(function () {
        $('#txtMonth').datetimepicker({
            language: 'zh-CN',
            weekStart: 1,
            todayBtn: 1,
            autoclose: 1,
            todayHighlight: 1,
            startView: 2,
            minView: 2,
            forceParse: 0
        });

        gridList();
        $("#gridList").jqGrid('setLabel', 'rn', '序号', { 'text-align': 'center', 'vertical-align': 'middle' });
    })
    function gridList() {
        var $gridList = $("#gridList");
        $gridList.dataGrid({
            url: "/Gas/Statistics/GetGridJsonMonth",
            height: $(window).height() - 96,
            colModel: [
                { label: "主键", name: "F_Id", hidden: true, key: true },
                { label: "年度", name: "Year", width: 150, align: 'left' },
                { label: '月度', name: 'Month', width: 200, align: 'left' },
                { label: '就餐次数', name: 'SubsidyCountMonth', width: 200, align: 'center' },
                { label: '补贴金额', name: 'SubsidyAmountMonth', width: 200, align: 'left' },
            ],
            pager: "#gridPager",
            sortname: 'Year desc,Month desc',
            viewrecords: true
        });
        $("#btn_search").click(function () {
            $gridList.jqGrid('setGridParam', {
                postData: {  Month: $("#txtMonth").val() },
            }).trigger('reloadGrid');
        });
    }
    function btn_details() {
        var Year = $("#gridList").jqGridRowValue().Year;
        var Month = $("#gridList").jqGridRowValue().Month;
        $.modalOpen({
            id: "Details",
            title: "月度明细",
            url: "/Gas/Statistics/MonthList?Year=" + Year +"&Month="+Month,
            width: "900px",
            height: "620px",
            btn: null,
        });
    }
</script>

<div class="topPanel">
    <div class="toolbar">
        <div class="btn-group">
            <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
        </div>
        <div class="btn-group">
            
        </div>
        <div class="operate">
            <ul class="nav nav-pills">
                <li><a id="NF-edit" onclick="btn_details()"><i class="fa fa-pencil-square-o"></i>明细</a></li>
            </ul>
            <a href="javascript:;" class="close"></a>
        </div>
        <script>$('.toolbar').authorizeButton()</script>
    </div>
    <div class="search">
        <table>
            <tr>
                <td>
                    <div class="input-group">
                        @*<input id="txtMonth" type="month" min="1900-01" max="2030-12" pattern="[0-9]{4}-[0-9]{2}" class="form-control" placeholder="月度" style="width: 200px;">*@
                        <input type="text" value="" id="txtMonth" class="form-control" data-date-format="yyyy年mm月" style="width: 200px;">
                        <span class="input-group-btn">
                            <button id="btn_search" type="button" class="btn  btn-primary"><i class="fa fa-search"></i></button>
                        </span>
                    </div>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
        <div class="gridPanel">
            <table id="gridList"></table>
            <div id="gridPager"></div>
        </div>
